var Test = {
    
  uncompressed : null,
  compressed   : null,
  
  
  init : function()
  {
    $.getJSON("data.json", (function(data)
    {
      this.uncompressed = JSON.stringify(data);
      
      console.log("loaded", this.uncompressed.length);
    }).bind(this));
  },

  compress : function()
  {
    console.time("compress");
  
    Deflate.compress(this.uncompressed, function(data)
    {
      this.compressed = data;
    
      console.timeEnd("compress");
      [
        ["binary", String(data).length],
        ["json",   JSON.stringify(data).length],
        ["base64", Base64.encode(data).length]
      ].forEach(function(pair)
      {
        console.log(pair[0], Math.round(pair[1] / this.uncompressed.length * 100) + "%");
      }, this);
    }, this);
  
    return false;
  },
  
  decompress : function()
  {
    console.time("decompress");
  
    Deflate.decompress(this.compressed, function(data)
    {
      console.timeEnd("decompress");
      console.log(data === this.uncompressed);
    }, this);
    
    return false;
  },
  
  decompressBase64 : function(base64)
  {
    console.time("decompress");
  
    Deflate.decompress(Base64.decode(base64), function(data)
    {
      console.timeEnd("decompress");
      console.log(data);
    }, this);
  
    return false;
  }
    
};